package com.example.abc.common;

import javax.servlet.http.HttpServletRequest; /**
 * Created by Peter on 2018/4/27.
 */
public class Column {
    private int index; // start 0
    private String data;
    private String name;
    private boolean searchable;
    private boolean orderable;
    private String search;
    private boolean regex;

    public Column(HttpServletRequest request, int i) {
        this.index = i;

        this.setData(request.getParameter("columns["+ i +"][data]"));
        this.setName(request.getParameter("columns["+ i +"][name]"));
        this.setOrderable(Boolean.valueOf(request.getParameter("columns["+ i +"][orderable]")));
        this.setRegex(Boolean.valueOf(request.getParameter("columns["+ i +"][search][regex]")));
        this.setSearch(request.getParameter("columns["+ i +"][search][value]"));
        this.setSearchable(Boolean.valueOf(request.getParameter("columns["+ i +"][searchable]")));

    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public boolean isRegex() {
        return regex;
    }

    public void setRegex(boolean regex) {
        this.regex = regex;
    }

    public String getSearch() {
        return search;
    }

    public void setSearch(String search) {
        this.search = search;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public boolean isSearchable() {
        return searchable;
    }

    public void setSearchable(boolean searchable) {
        this.searchable = searchable;
    }

    public boolean isOrderable() {
        return orderable;
    }

    public void setOrderable(boolean orderable) {
        this.orderable = orderable;
    }

}
